package com.briup.mt.web.controller;

import com.briup.mt.bean.BaseRole;
import com.briup.mt.service.BaseRoleService;
import com.briup.mt.utils.Message;
import com.briup.mt.utils.MessageUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.List;
@RestController
@Validated
@RequestMapping("/BaseRole")
public class BaseRoleController {
    @Resource
    private BaseRoleService baseRoleService;
    @GetMapping("query")
    public Message query(String name){
        List<BaseRole> list=baseRoleService.query(name);
        return MessageUtil.success(list);
    }
    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(BaseRole baseRole){
        baseRoleService.saveOrUpdate(baseRole);
        return MessageUtil.success("操作成功");
    }
    @DeleteMapping("deleteById")
@ApiImplicitParams({
                @ApiImplicitParam(name="id",value = "用户编号",required = true,paramType = "query"),

        })
    public Message deleteById(@NotNull long id){
        baseRoleService.deleteById(id);
            return  MessageUtil.success("操作成功");
        }

    }

